home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDAOPTLS.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  6.5 KB  |  171 lines

  1.  
  2.  /*=======================================================================*/
  3.  /*                                                                       */
  4.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  5.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  6.  /*                       Schaumburg, Illinois 60173                      */
  7.  /*                          All Rights Reserved                          */
  8.  /*                           InstallShield (R)                           */
  9.  /*                                                                       */
  10.  /*   File    : sdaoptls.rul                                              */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdAskOptionsList      */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*-----------------------------------------------------------------------*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdAskOptionsList                                           */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will let user choose different parts of the    */
  22.  /*             software to install based on the names.                    */
  23.  /*   Misc:                                                                */
  24.  /*                                                                        */
  25.  /*------------------------------------------------------------------------*/
  26. #define CMPTVIEW_INFO_DISPLAYSIZE 6
  27. #define CMPTVIEW_INFO_EXCLUSIVE   7
  28.  
  29. function SdAskOptionsList( szTitle, szMsg, szComponents, nExclusive )
  30.           STRING  szDlg, szTemp;
  31.           NUMBER  nId, nTemp, nComponentView;
  32.           HWND    hwndDlg, hwndButton, hwndListBox;
  33.           BOOL    bDone;
  34.         begin
  35.  
  36.  
  37.            szDlg     = SD_DLG_ASKOPTIONSLIST;
  38.            nSdDialog = SD_NDLG_ASKOPTIONSLIST1; // represents both dialogs
  39.  
  40.           // record data produced by this dialog
  41.           if (MODE=SILENTMODE) then
  42.             SdMakeName( szAppKey, szDlg, szTitle, nSdAskOptionsList );
  43.             SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  44.             if ((nId != BACK) && (nId != CANCEL)) then
  45.                SilentReadData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  46.             endif;
  47.  
  48.             return nId;
  49.           endif;
  50.  
  51.            // ensure general initialization is complete
  52.            if (!bSdInit) then
  53.               SdInit();
  54.            endif;
  55.  
  56.            if (nExclusive = EXCLUSIVE) then
  57.               if (EzDefineDialog( szDlg, "", "", SD_NDLG_ASKOPTIONSLIST2 ) = DLG_ERR) then
  58.                 return -1;
  59.               endif;
  60.            else
  61.               if (EzDefineDialog( szDlg, "", "", SD_NDLG_ASKOPTIONSLIST1 ) = DLG_ERR) then
  62.                 return -1;
  63.               endif;
  64.            endif;
  65.  
  66.  
  67.            // Loop in dialog until the user selects a standard button
  68.            bDone = FALSE;
  69.  
  70.            while (!bDone)
  71.  
  72.               nId = WaitOnDialog( szDlg );
  73.  
  74.               switch (nId)
  75.               case DLG_INIT:
  76.  
  77.                    hwndDlg = CmdGetHwndDlg( szDlg );
  78.  
  79.                    if (nExclusive = EXCLUSIVE) then
  80.                       hwndButton = GetDlgItem( hwndDlg, SD_PBUT_SELECTALL );
  81.                       if (IsWindow( hwndButton )) then
  82.                         ShowWindow( hwndButton, SW_HIDE );
  83.                         EnableWindow( hwndButton, FALSE );
  84.                       endif;
  85.  
  86.                       hwndButton = GetDlgItem( hwndDlg, SD_PBUT_DESELECTALL );
  87.                       if (IsWindow( hwndButton )) then
  88.                         ShowWindow( hwndButton, SW_HIDE );
  89.                         EnableWindow( hwndButton, FALSE );
  90.                       endif;
  91.                    endif;
  92.  
  93.                    if( szMsg != "" ) then
  94.                        SdSetStatic( szDlg, SD_STA_MSG, szMsg );
  95.                    endif;
  96.  
  97.                    SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
  98.  
  99.                    if(szTitle != "") then
  100.                        SetWindowText(hwndDlg, szTitle);
  101.                    endif;
  102.  
  103.                    nComponentView = SdCreateComponentView( hwndDlg, SD_LISTBOX, szComponents, "" );
  104.                    if (!nComponentView) then
  105.                        SdError( -1, "SdAskOptionsList" );
  106.                        nId = -1;
  107.                        bDone = TRUE;
  108.                    endif;
  109.  
  110.                    ComponentViewSetInfo( nComponentView, CMPTVIEW_INFO_DISPLAYSIZE, FALSE, "");
  111.                    if (nExclusive = EXCLUSIVE) then
  112.                        ComponentViewSetInfo( nComponentView, CMPTVIEW_INFO_EXCLUSIVE, TRUE, "");
  113.                    endif;
  114.  
  115.                    ComponentViewRefresh( nComponentView, 0 );
  116.                    
  117.                    hwndListBox = GetDlgItem( hwndDlg, SD_LISTBOX );
  118.                    SetFocus( hwndListBox );
  119.  
  120.  
  121.               case SD_PBUT_SELECTALL:
  122.                    ComponentViewSelectAll( nComponentView, TRUE );
  123.  
  124.               case SD_PBUT_DESELECTALL:
  125.                    ComponentViewSelectAll( nComponentView, FALSE );
  126.  
  127.               case SD_PBUT_OK:
  128.  
  129.                    nId   = OK;
  130.                    bDone = TRUE;
  131.  
  132.               case BACK:
  133.                    nId    = BACK;
  134.                    bDone  = TRUE;
  135.  
  136.               case DLG_ERR:
  137.                    SdError( -1, "SdAskOptionsList" );
  138.                    nId   = -1;
  139.                    bDone = TRUE;
  140.  
  141.               case DLG_CLOSE:
  142.                    SdCloseDlg( hwndDlg, nId, bDone );
  143.  
  144.               default:
  145.                    // check standard handling
  146.                    if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  147.                       bDone = TRUE;
  148.                    endif;
  149.               endswitch;
  150.  
  151.            endwhile;
  152.  
  153.            EndDialog( szDlg );
  154.            ReleaseDialog( szDlg );
  155.            ComponentViewDestroy( nComponentView );
  156.  
  157.            SdUnInit( );
  158.  
  159.  
  160.            // record data produced by this dialog
  161.            SdMakeName( szAppKey, szDlg, szTitle, nSdAskOptionsList );
  162.            SilentWriteData( szAppKey, "Component", DATA_COMPONENT, szComponents, nTemp );
  163.            SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  164.  
  165.            return nId;
  166.  
  167.         end;
  168.  
  169.  
  170.  
  171.